[?php include_stylesheets_for_form($form) ?]
[?php include_javascripts_for_form($form) ?]


[?php $widget_per_row = 4 ?]
[?php $i = 1 ?]

<div id="sf_admin_filter_container">
    <div id="sf_admin_filter_header">
        FIltros
    </div>
<div id="sf_admin_filter" class="sf_admin_filter">
  [?php if ($form->hasGlobalErrors()): ?]
    [?php echo $form->renderGlobalErrors() ?]
  [?php endif; ?]


  <form action="[?php echo url_for('<?php echo $this->getUrlForAction('collection') ?>', array('action' => 'filter')) ?]" method="post">
    <table cellspacing="0"  style="width: 100%;">
      <!--thead>
          <tr>
              <th colspan='[?php echo $widget_per_row*2 ?]'>FIltros</th>
          </tr>
      </thead-->
      <tfoot>
        <tr>
          <td colspan="[?php echo $widget_per_row*2 ?]">
            [?php echo $form->renderHiddenFields() ?]
            [?php echo link_to(__('Reset', array(), 'sf_admin'), '<?php echo $this->getUrlForAction('collection') ?>', array('action' => 'filter'), array('query_string' => '_reset', 'method' => 'post')) ?]
            <input type="submit" value="[?php echo __('Filter', array(), 'sf_admin') ?]" />
          </td>
        </tr>
      </tfoot>
      <tbody>
          [?php $last_field = count($configuration->getFormFilterFields($form))  ?]
        [?php foreach ($configuration->getFormFilterFields($form) as $name => $field): ?]
        [?php if ((isset($form[$name]) && $form[$name]->isHidden()) || (!isset($form[$name]) && $field->isReal())) continue ?]
          [?php include_partial('<?php echo $this->getModuleName() ?>/filters_field', array(
            'name'       => $name,
            'attributes' => $field->getConfig('attributes', array()),
            'label'      => $field->getConfig('label'),
            'help'       => $field->getConfig('help'),
            'form'       => $form,
            'field'      => $field,
            'count'      => $i,
            'last_field'      => $last_field,
            'widget_per_row' => $widget_per_row,
            'class'      => 'sf_admin_form_row sf_admin_'.strtolower($field->getType()).' sf_admin_filter_field_'.$name,
          )) ?]
         
          [?php $i++; ?] 
        [?php endforeach; ?]
      </tbody>
    </table>
  </form>
</div>
</div>

<script language="javascript" type="text/javascript">
   jQuery(document).ready(function(){
            //jQuery("#sf_admin_filter").slideUp();
  
        jQuery("#sf_admin_filter_header").bind('click',function(){
            jQuery("#sf_admin_filter").slideToggle();
        });
    });

</script>